package com.xxxx.web.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xxxx.web.dto.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;

/**
 * 商品表表
 */
@Data
@TableName("`Cargo`")
public class Cargo extends BaseEntity {


    /**
     * 规格型号
     */
    @JsonProperty("Specification")
    @TableField(value = "Specification", updateStrategy = FieldStrategy.IGNORED)
    private String Specification;

    /**
     * 仓库
     */
    @JsonProperty("WarehouseId")
    @TableField(value = "WarehouseId", updateStrategy = FieldStrategy.IGNORED)
    private Integer WarehouseId;

    /**
     * 品牌
     */
    @JsonProperty("Brand")
    @TableField(value = "Brand", updateStrategy = FieldStrategy.IGNORED)
    private String Brand;

    /**
     * 商品名称
     */
    @JsonProperty("Name")
    @TableField(value = "Name", updateStrategy = FieldStrategy.IGNORED)
    private String Name;

    /**
     * 货主
     */
    @JsonProperty("CustomerId")
    @TableField(value = "CustomerId", updateStrategy = FieldStrategy.IGNORED)
    private Integer CustomerId;

    /**
     * 单位
     */
    @JsonProperty("Unit")
    @TableField(value = "Unit", updateStrategy = FieldStrategy.IGNORED)
    private String Unit;

    /**
     * 条码
     */
    @JsonProperty("SKU")
    @TableField(value = "SKU", updateStrategy = FieldStrategy.IGNORED)
    private String SKU;

    /**
     * 商品分类
     */
    @JsonProperty("CargoTypeId")
    @TableField(value = "CargoTypeId", updateStrategy = FieldStrategy.IGNORED)
    private Integer CargoTypeId;

    /**
     * 最低库存预警
     */
    @JsonProperty("MinStockAlert")
    @TableField(value = "MinStockAlert", updateStrategy = FieldStrategy.IGNORED)
    private Double MinStockAlert;

    /**
     * 最高库存限制
     */
    @JsonProperty("MaxStockLimit")
    @TableField(value = "MaxStockLimit", updateStrategy = FieldStrategy.IGNORED)
    private Double MaxStockLimit;

    /**
     * 把商品表实体转换成商品表传输模型
     */
    public CargoDto MapToDto() throws InvocationTargetException, IllegalAccessException {
        CargoDto CargoDto = new CargoDto();

        BeanUtils.copyProperties(CargoDto, this);

        return CargoDto;
    }

}
